Day 7 - Sequences and counting

27

$ echo -n "This is a test" | wc -c

14

Exercises

I have one exercise for you this time! Yay! Your excitement is so great that it is travelling in time

and reaching me in the past, while I’m writing the book. You can skip it if you want, but I think you

should try to solve it to see if we are on the same page.

Exercise 7.01

Print the numbers from 5 to 15 padded with enough zeros to fill 5 digits, i.e. 00005, 00006, 00007,

and so on.

Go to solution

Exercise 7.02

Count the number of lines of the file simple.log

Go to solution

That’s it for today, I promised you it would have been a relaxing lesson: simple concepts, no

homework, what more can you desire? A nice walk, this is what you need! Go, enjoy the nature

if you can, or get your mecha and fight the alien invaders one zero-padded sequence at a time!

Suggested film for the evening: WarGames (1983) - A young Unix programmer teaches a supercom-

puter to run a sequence of battle simulations and to count the casualties.